<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@page import="it.milanoeasy.utils.Utils"%>
<%@page import="it.milanoeasy.gae.User"%>
<%@page import="com.google.appengine.api.users.UserService"%>
<%@page import="com.google.appengine.api.users.UserServiceFactory"%>

<style type="text/css">
#google_login { 
	height: 44px; 
	background-color:#b0c4de;
	font-family: arial, verdana, sans-serif;
	font-weight: bold;
	font-size: .8em;
	color: #0033FF;
}
</style>
   
<%
	UserService userService = null;
	try {
		userService = UserServiceFactory.getUserService();
	} catch(Exception e) {
		System.out.println("Error: "+e.getMessage());
	}
	User user=(User)request.getAttribute("user");
%>
<div id="google_login">
	<table width=100% cellspacing=0>	
		<tr>			
			<td width=40px>
				<a onclick="toogleEdicole()" href="javascript:void(0);"  title="mostra/nascondi le edicole"><img src="images/news_icon.png" width=35 height=35/></a>
			</td>
			<td width=40px>
				<a onclick="toogleVarchi()" href="javascript:void(0);"  title="mostra/nascondi i varchi dell'area C"><img src="images/telecamera.png" width=35 height=35/></a>
			</td>
			
			<td align=left id="messages"></td>
			
			<td>
			<%if (Utils.isMobileUA(request.getHeader("User-Agent"))) { %>
				<a href="https://play.google.com/store/apps/details?id=com.milanoeasy.milanoeasyparking&hl=it"><img src="images/download_android.png"/></a>
			<%	} %>
			</td>
			<td align=right>
				<a onclick="findCar()" href="javascript:void(0);" title="dove ho parcheggiato"><img align=right id="findcar" src="images/find_car_off.png"/></a>
			</td>
			<td align=right>
				<a onclick="parkCar()" href="javascript:void(0);" title="centra la mappa sulla tua posizione corrente"><img id="park" src="images/car.png"/></a>
			</td>
			<td align=right>
				<a onclick="centerMap()" href="javascript:void(0);" title="centra la mappa sulla tua posizione corrente"><img id="centerImg" src="images/target2.png"/></a>
			</td>					
			<td align=right>			
				<div title="Nickname: <%= user.getNickname()%> 
					UserId: <%= user.getUserId()%> 
					Email:<%= user.getEmail()%>
					AuthDomain: <%= user.getAuthDomain()%> 
					FederatedIdentity: <%= user.getFederatedIdentity()%>">
					<%=user.getNickname()%>
				</div>
	  		</td>
	  		<td width=10%> 				 
				<% if (user.isLoggedOnGoogle()) {			
				%>
					<a href="<%= userService.createLogoutURL(User.getRequestURI(request)) %>">logout</a> 
					<!-- <a href="_ah/logout?continue=%2Fxxxx">logout</a>  -->
					<!-- <a href="user?logout">logout2</a>  -->
				<% } else {
				if (userService!=null) { %>
					<a href="<%= userService.createLoginURL(User.getRequestURI(request)) %>"><img src="images/google-sign-in.png"/></a>			
					<!-- <a href="_ah/login?continue=%2Fxxxx">login</a>  -->
				<% }} %>
			</td>
		</tr>
	</table>	
</div>